 <?php
 	include ('common/constants.php');
	include ('common/db.php');
    session_start();
    session_destroy();
 ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>User Login</title>
<link href="resources/css/bootstrap.min.css" rel="stylesheet">
<link href="resources/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="resources/css/datepicker.css" rel="stylesheet">
<link href="resources/css/bootstrap-timepicker.min.css" rel="stylesheet">
<style type="text/css">
body {
        padding-top: 40px;
        padding-bottom: 40px;
        background-color: #f5f5f5;
      }

      .form-signin {
        max-width: 300px;
        padding: 19px 29px 29px;
        margin: 0 auto 20px;
        background-color: #fff;
        border: 1px solid #e5e5e5;
        -webkit-border-radius: 5px;
           -moz-border-radius: 5px;
                border-radius: 5px;
        -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
           -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
                box-shadow: 0 1px 2px rgba(0,0,0,.05);
      }
      .form-signin .form-signin-heading,
      .form-signin .checkbox {
        margin-bottom: 10px;
      }
      .form-signin input[type="text"],
      .form-signin input[type="password"] {
        font-size: 16px;
        height: auto;
        margin-bottom: 15px;
        padding: 7px 9px;
      }

</style>
</head>

<body>

<div class="navbar navbar-inverse navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container"> 
    	<a class="btn btn-navbar" style="margin-top: 25px;" data-toggle="collapse" data-target=".nav-collapse">
          <span class="icon-bar"></span> 
          <span class="icon-bar"></span> 
          <span class="icon-bar"></span> 
      	</a> <a class="brand" style="text-align:center;" href="#"><img src="resources/icons/share_ride.png" style="max-width:55px; padding-right:15px"/>Carpooling.lk</a>
      <div class="nav-collapse collapse" style="float:right">
        <ul class="nav navbar-nav">
          <li style="text-align:center; float:left">
          	<a href="contact_us.php"><img src="resources/icons/contact_us.png" style="max-width:40px; min-width: 20px;"/><br />Contact us</a>
          </li>
          <li style="text-align:center; float:left">
          	<a href="about_us.php"><img src="resources/icons/about_us.png" style="max-width:40px; min-width: 20px;"/><br />About us</a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</div>
<div style="height:85px"></div>
<div class="container">
  
    <form class="form-signin" id="signin-form">
        <h2 class="form-signin-heading">Sign in</h2>
        <input type="text" class="input-block-level" placeholder="Email address" name="email" name="email" />
        <input type="password" class="input-block-level" placeholder="Password" name="pass" name="pass" />
        <!--
        <label class="checkbox">
          <input type="checkbox" value="remember-me"> Remember me
        </label>
        -->
        <button class="btn btn-large btn-primary" type="submit" id="signin" onclick="submitForm(); return false;">Sign in</button>
        <!--
        <br />
        <a href="#">Forgot password ?</a>
        -->
        <br />
        <h4 class="form-signin-heading">New user</h4>
        <a href="reg_step_1.php" class="btn btn-large btn-primary" type="button">Sign up</a>
    </form>

    <!-- Site footer -->
    <div class="navbar navbar-inverse navbar-fixed-bottom">
    	<div class="navbar-inner"> <a class="brand" href="#" style="padding-left:7%">&copy; Carpooling.lk 2013</a> </div>
    </div>
</div>

<!-- JAVASCRIPT INCLUDES -->
<script type="text/javascript" src="resources/js/jquery.min.js"></script>
<script type="text/javascript" src="resources/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="resources/js/bootstrap-timepicker.min.js"></script>
<script type="text/javascript" src="resources/js/bootstrap-collapse.js"></script>
<script type="text/javascript" src="resources/js/bootstrap-transition.js"></script>
<script type="text/javascript">
function submitForm(){
      jQuery.ajax({
        url: 'loginvalidate.php',
        type: "POST",
        data: $('#signin-form').serialize(),
        success: function(data) {
          if(data=="success"){
            window.location.replace("home.php");
          }else{  
            //showMsg(data); 
            alert("Wrong password or username. ");
          }
        }
      });
  }
</script>
</body>
</html>
